package com.kaiwukj.android.ufamily.mvp.ui.page.dynamic.report;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.alibaba.android.arouter.launcher.ARouter;
import com.kaiwukj.android.ufamily.R;
import com.kaiwukj.android.ufamily.app.base.review.BaseFragment;
import com.kaiwukj.android.ufamily.app.constant.Constant;
import com.qmuiteam.qmui.widget.QMUITopBar;

import butterknife.BindView;

import static com.kaiwukj.android.ufamily.app.constant.ARouterUrlKt.WebViewUrl;

public class ReportCardSuccessFragment extends BaseFragment {
    @BindView(R.id.tv_report_card_success_hint)
    TextView mTextView;
    private QMUITopBar mTopBar;

    public static ReportCardSuccessFragment newInstance() {
        return new ReportCardSuccessFragment();
    }


    @Override
    protected int getLayoutId() {
        return R.layout.fragment_report_card_success;
    }

    @Override
    protected void initView() {

    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        assert getActivity() != null;
        mTopBar = this.getActivity().findViewById(R.id.qtb_social_circle);
        initTopBar(mTopBar);
        //mPresenter.requestReportCardType();
        mTextView.setText(Html.fromHtml(getString(R.string.report_card_success_hint)));
        mTextView.setOnClickListener(view ->
                ARouter.getInstance().build(WebViewUrl)
                        .withString("EXTRA_KEY_WEB_URL", Constant.H5_PRIVACE)
                        .withString("EXTRA_KEY_WEB_TITLE", "隐私协议")
                        .navigation());
    }

    private void initTopBar(QMUITopBar topBar) {
        topBar.setTitle(getString(R.string.social_circle_card_report_success));
        topBar.removeAllRightViews();
        topBar.removeAllLeftViews();
        topBar.addLeftBackImageButton().setOnClickListener(view -> {
            if (getActivity() != null)
                getActivity().finish();
        });
    }

}
